package com.hitqz.robot.api.business.dto;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.hitqz.robot.api.business.component.MyStringImageConverter;
import lombok.Data;

import java.util.Date;
import java.util.Objects;

/**
 * @author wengyx
 * @date 2024/8/7
 * 检测结果
 */
@Data
@ExcelIgnoreUnannotated
@HeadRowHeight(20)
@ColumnWidth(20)
@ContentRowHeight(80)
public class PatrolResultExcelDto {
    @ExcelProperty(value = "序号")
    private Integer index;
    @ExcelProperty(value = "区域名称")
    private String roomName;
    @ExcelProperty(value = "设备名称")
    private String devName;
    @ExcelProperty(value ="部位名称")
    private String itemName;
    @ExcelProperty(value ="点检内容")
    private String objectName;
    @ExcelProperty(value ="检测标准")
    private String normalValue;
    @DateTimeFormat("yyyy/MM/dd HH:mm:ss")
    @ExcelProperty(value ="检测时间")
    private Date checkTime;
    @ExcelProperty(value ="检测值")
    private String showValue;
    @ExcelProperty(value ="检测结果")
    private String statusStr;
    @ExcelProperty(value ="图片",converter = MyStringImageConverter.class)
    private String path;
//    @ExcelProperty(value ="人工复检")
    private String auditStatusStr;
//    @ExcelProperty(value ="人工复检时间")
//    @DateTimeFormat("yyyy/MM/dd HH:mm:ss")
    private Date auditTime;
//    @ExcelProperty(value ="审核人")
    private String auditor;
//    @ExcelProperty(value ="操作人")
    private String operator;
//    @ExcelProperty(value ="备注")
    private String auditRemark;



    private Integer status;

    private Integer auditStatus;

    public String getStatusStr() {
        if (Objects.equals(status,0)){
            statusStr="未检测";
        }
        if (Objects.equals(status,1)){
            statusStr="正常";
        }
        if (Objects.equals(status,2)){
            statusStr="异常";
        }
        if (Objects.equals(status,3)){
            statusStr="视觉识别失败";
        }
        return statusStr;
    }

    public String getAuditStatusStr() {
        if (Objects.equals(auditStatus,0)){
            auditStatusStr="未审核";
        }
        if (Objects.equals(auditStatus,1)){
            auditStatusStr="正报";
        }
        if (Objects.equals(auditStatus,2)){
            auditStatusStr="误报";
        }
        if (Objects.equals(auditStatus,3)){
            auditStatusStr="无异常";
        }
        return auditStatusStr;
    }

}
